 //
//  CartoonDetailsCommentTableViewCell.m
//  Cartoon
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 YSZ. All rights reserved.
//

#import "CartoonDetailsCommentTableViewCell.h"

@implementation CartoonDetailsCommentTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.myImageView = [UIImageView new];
        _myImageView.layer.cornerRadius = 20;
        _myImageView.clipsToBounds = YES;
        self.myNameLabel = [UILabel new];
        self.myTimeLabel = [UILabel new];
        self.myCommentLabel = [UILabel new];
        [self.contentView addSubview:_myCommentLabel];
        [self.contentView addSubview:_myImageView];
        [self.contentView addSubview:_myNameLabel];
        [self.contentView addSubview:_myTimeLabel];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    _myImageView.frame = CGRectMake(20, 20, 40, 40);
    _myNameLabel.frame = CGRectMake(_myImageView.frame.origin.x + _myImageView.frame.size.width + 10, 20, width / 2, 20);
    _myNameLabel.textColor = [UIColor colorWithRed:13 / 255.0 green:184 / 255.0 blue: 240 / 255.0 alpha:1];
    _myTimeLabel.frame = CGRectMake(20 + 40 + 10, _myNameLabel.frame.origin.y + 20, _myNameLabel .frame.size.width, 20);
    _myTimeLabel.font = [UIFont systemFontOfSize:12];
    
    self.myCommentLabel.frame = CGRectMake(20 + 40 + 10, _myTimeLabel.frame.origin.y + 20, width - 20 - 40 - 10 - 40, height - 60);
    _myCommentLabel.numberOfLines = 0;
    [_myCommentLabel sizeToFit];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
